package eu.jpereira.trainings.designpatterns.creational.builder;

import java.util.ArrayList;
import java.util.List;

import eu.jpereira.trainings.designpatterns.creational.builder.model.ReportBody;

public abstract class ReportBodyBuilder {
	
	protected class Item {
		public String name;
		public int quantity;
		public double price;
	}
	
	protected String customerName = "";
	protected String phoneNumber = "";
	protected List<Item> soldItems = new ArrayList<Item>();
	
	public ReportBodyBuilder setCustomerName(String customerName) {
		this.customerName = customerName;
		
		return this;
	}
	
	public ReportBodyBuilder setCustomerPhone(String phoneNumber) {
		this.phoneNumber = phoneNumber;
		
		return this;
	}
	
	public ReportBodyBuilder addItem(String name, int quantity, double price) {
		Item item = new Item();
		item.name = name;
		item.quantity = quantity;
		item.price = price;
		soldItems.add(item);
		
		return this;
	}
	
	public abstract ReportBody getReportBody();
	
}